function loadTemplate (root, tmpl, data, callback) {
    function aux () {
	$.tmpl(tmpl.name, data).prependTo( root );
	callback () ;
    }

    if ($.template[tmpl.name]) aux() ; 
    else $.get(tmpl.file, function (template) { 
	$.template(tmpl.name, template );
	aux ();
    });
}

var serveur = "http://localhost:8003" ;
var doNothing = function () {



    $("body").focusout (

	function (evt) {
	    postit = $(evt.srcElement).parent("div.card") ;
	    
	    updatePostit (postit) ; 

	}
    )

};


function updatePostit (postit) {
    
//    var txt = postit.



}

function loadPostiT (session) {




    session = (session)?session:0 ; 
    $.get(serveur+"/message", {sid:session}, function (data) {
	console.log(data)
	loadTemplate($("body"), {name:"postIt", file:"tmpl/postit.tmpl"}, {a:data}
		     , doNothing)
    })





}

//$(loadPostiT(1))



var miserables = {
  nodes:[
    {nodeName:"Myriel", group:1},
    {nodeName:"Napoleon", group:1},
    {nodeName:"Mlle. Baptistine", group:1},
    {nodeName:"Mme. Magloire", group:1},
    {nodeName:"Countess de Lo", group:1},
    {nodeName:"Geborand", group:1},
    {nodeName:"Champtercier", group:1},
    {nodeName:"Cravatte", group:1},
    {nodeName:"Count", group:1},
    {nodeName:"Old Man", group:1},
    {nodeName:"Labarre", group:2},
    {nodeName:"Valjean", group:2},
    {nodeName:"Marguerite", group:3},
    {nodeName:"Mme. de R", group:2},
    {nodeName:"Isabeau", group:2},
    {nodeName:"Gervais", group:2},
    {nodeName:"Tholomyes", group:3},
    {nodeName:"Listolier", group:3},
    {nodeName:"Fameuil", group:3},
    {nodeName:"Blacheville", group:3},
    {nodeName:"Favourite", group:3},
    {nodeName:"Dahlia", group:3},
    {nodeName:"Zephine", group:3},
    {nodeName:"Fantine", group:3},
    {nodeName:"Mme. Thenardier", group:4},
    {nodeName:"Thenardier", group:4},
    {nodeName:"Cosette", group:5},
    {nodeName:"Javert", group:4},
    {nodeName:"Fauchelevent", group:0},
    {nodeName:"Bamatabois", group:2},
    {nodeName:"Perpetue", group:3},
    {nodeName:"Simplice", group:2},
    {nodeName:"Scaufflaire", group:2},
    {nodeName:"Woman 1", group:2},
    {nodeName:"Judge", group:2},
    {nodeName:"Champmathieu", group:2},
    {nodeName:"Brevet", group:2},
    {nodeName:"Chenildieu", group:2},
    {nodeName:"Cochepaille", group:2},
    {nodeName:"Pontmercy", group:4},
    {nodeName:"Boulatruelle", group:6},
    {nodeName:"Eponine", group:4},
    {nodeName:"Anzelma", group:4},
    {nodeName:"Woman 2", group:5},
    {nodeName:"Mother Innocent", group:0},
    {nodeName:"Gribier", group:0},
    {nodeName:"Jondrette", group:7},
    {nodeName:"Mme. Burgon", group:7},
    {nodeName:"Gavroche", group:8},
    {nodeName:"Gillenormand", group:5},
    {nodeName:"Magnon", group:5},
    {nodeName:"Mlle. Gillenormand", group:5},
    {nodeName:"Mme. Pontmercy", group:5},
    {nodeName:"Mlle. Vaubois", group:5},
    {nodeName:"Lt. Gillenormand", group:5},
    {nodeName:"Marius", group:8},
    {nodeName:"Baroness T", group:5},
    {nodeName:"Mabeuf", group:8},
    {nodeName:"Enjolras", group:8},
    {nodeName:"Combeferre", group:8},
    {nodeName:"Prouvaire", group:8},
    {nodeName:"Feuilly", group:8},
    {nodeName:"Courfeyrac", group:8},
    {nodeName:"Bahorel", group:8},
    {nodeName:"Bossuet", group:8},
    {nodeName:"Joly", group:8},
    {nodeName:"Grantaire", group:8},
    {nodeName:"Mother Plutarch", group:9},
    {nodeName:"Gueulemer", group:4},
    {nodeName:"Babet", group:4},
    {nodeName:"Claquesous", group:4},
    {nodeName:"Montparnasse", group:4},
    {nodeName:"Toussaint", group:5},
    {nodeName:"Child 1", group:10},
    {nodeName:"Child 2", group:10},
    {nodeName:"Brujon", group:4},
    {nodeName:"Mme. Hucheloup", group:8}
  ],
  links:[
    {source:1, target:0, value:10},
    {source:2, target:0, value:80},
    {source:3, target:0, value:100},
    {source:3, target:2, value:60},
    {source:4, target:0, value:10},
    {source:5, target:0, value:10},
    {source:6, target:0, value:10},
    {source:7, target:0, value:10},
    {source:8, target:0, value:20},
    {source:9, target:0, value:10},
    {source:11, target:10, value:10},
    {source:11, target:3, value:30},
    {source:11, target:2, value:30},
    {source:11, target:0, value:50},
    {source:12, target:11, value:10},
    {source:13, target:11, value:10},
    {source:14, target:11, value:10},
    {source:15, target:11, value:10},
    {source:17, target:16, value:40},
    {source:18, target:16, value:40},
    {source:18, target:17, value:40},
    {source:19, target:16, value:40},
    {source:19, target:17, value:40},
    {source:19, target:18, value:40},
    {source:20, target:16, value:30},
    {source:20, target:17, value:30},
    {source:20, target:18, value:30},
    {source:20, target:19, value:40},
    {source:21, target:16, value:30},
    {source:21, target:17, value:30},
    {source:21, target:18, value:30},
    {source:21, target:19, value:30},
    {source:21, target:20, value:50},
    {source:22, target:16, value:30},
    {source:22, target:17, value:30},
    {source:22, target:18, value:30},
    {source:22, target:19, value:30},
    {source:22, target:20, value:40},
    {source:22, target:21, value:40},
    {source:23, target:16, value:30},
    {source:23, target:17, value:30},
    {source:23, target:18, value:30},
    {source:23, target:19, value:30},
    {source:23, target:20, value:40},
    {source:23, target:21, value:40},
    {source:23, target:22, value:40},
    {source:23, target:12, value:20},
    {source:23, target:11, value:90},
    {source:24, target:23, value:20},
    {source:24, target:11, value:70},
    {source:25, target:24, value:130},
    {source:25, target:23, value:10},
    {source:25, target:11, value:120},
    {source:26, target:24, value:40},
    {source:26, target:11, value:310},
    {source:26, target:16, value:10},
    {source:26, target:25, value:10},
    {source:27, target:11, value:170},
    {source:27, target:23, value:50},
    {source:27, target:25, value:50},
    {source:27, target:24, value:10},
    {source:27, target:26, value:10},
    {source:28, target:11, value:80},
    {source:28, target:27, value:10},
    {source:29, target:23, value:10},
    {source:29, target:27, value:10},
    {source:29, target:11, value:20},
    {source:30, target:23, value:10},
    {source:31, target:30, value:20},
    {source:31, target:11, value:30},
    {source:31, target:23, value:20},
    {source:31, target:27, value:10},
    {source:32, target:11, value:10},
    {source:33, target:11, value:20},
    {source:33, target:27, value:10},
    {source:34, target:11, value:30},
    {source:34, target:29, value:20},
    {source:35, target:11, value:30},
    {source:35, target:34, value:30},
    {source:35, target:29, value:20},
    {source:36, target:34, value:20},
    {source:36, target:35, value:20},
    {source:36, target:11, value:20},
    {source:36, target:29, value:10},
    {source:37, target:34, value:20},
    {source:37, target:35, value:20},
    {source:37, target:36, value:20},
    {source:37, target:11, value:20},
    {source:37, target:29, value:10},
    {source:38, target:34, value:20},
    {source:38, target:35, value:20},
    {source:38, target:36, value:20},
    {source:38, target:37, value:20},
    {source:38, target:11, value:20},
    {source:38, target:29, value:10},
    {source:39, target:25, value:10},
    {source:40, target:25, value:10},
    {source:41, target:24, value:20},
    {source:41, target:25, value:30},
    {source:42, target:41, value:20},
    {source:42, target:25, value:20},
    {source:42, target:24, value:10},
    {source:43, target:11, value:30},
    {source:43, target:26, value:10},
    {source:43, target:27, value:10},
    {source:44, target:28, value:30},
    {source:44, target:11, value:10},
    {source:45, target:28, value:20},
    {source:47, target:46, value:10},
    {source:48, target:47, value:20},
    {source:48, target:25, value:10},
    {source:48, target:27, value:10},
    {source:48, target:11, value:10},
    {source:49, target:26, value:30},
    {source:49, target:11, value:20},
    {source:50, target:49, value:10},
    {source:50, target:24, value:10},
    {source:51, target:49, value:90},
    {source:51, target:26, value:20},
    {source:51, target:11, value:20},
    {source:52, target:51, value:10},
    {source:52, target:39, value:10},
    {source:53, target:51, value:10},
    {source:54, target:51, value:20},
    {source:54, target:49, value:10},
    {source:54, target:26, value:10},
    {source:55, target:51, value:60},
    {source:55, target:49, value:120},
    {source:55, target:39, value:10},
    {source:55, target:54, value:10},
    {source:55, target:26, value:210},
    {source:55, target:11, value:190},
    {source:55, target:16, value:10},
    {source:55, target:25, value:20},
    {source:55, target:41, value:50},
    {source:55, target:48, value:40},
    {source:56, target:49, value:10},
    {source:56, target:55, value:10},
    {source:57, target:55, value:10},
    {source:57, target:41, value:10},
    {source:57, target:48, value:10},
    {source:58, target:55, value:70},
    {source:58, target:48, value:70},
    {source:58, target:27, value:60},
    {source:58, target:57, value:10},
    {source:58, target:11, value:40},
    {source:59, target:58, value:150},
    {source:59, target:55, value:50},
    {source:59, target:48, value:60},
    {source:59, target:57, value:20},
    {source:60, target:48, value:10},
    {source:60, target:58, value:40},
    {source:60, target:59, value:20},
    {source:61, target:48, value:20},
    {source:61, target:58, value:60},
    {source:61, target:60, value:20},
    {source:61, target:59, value:50},
    {source:61, target:57, value:10},
    {source:61, target:55, value:10},
    {source:62, target:55, value:90},
    {source:62, target:58, value:170},
    {source:62, target:59, value:130},
    {source:62, target:48, value:70},
    {source:62, target:57, value:20},
    {source:62, target:41, value:10},
    {source:62, target:61, value:60},
    {source:62, target:60, value:30},
    {source:63, target:59, value:50},
    {source:63, target:48, value:50},
    {source:63, target:62, value:60},
    {source:63, target:57, value:20},
    {source:63, target:58, value:40},
    {source:63, target:61, value:30},
    {source:63, target:60, value:20},
    {source:63, target:55, value:10},
    {source:64, target:55, value:50},
    {source:64, target:62, value:120},
    {source:64, target:48, value:50},
    {source:64, target:63, value:40},
    {source:64, target:58, value:100},
    {source:64, target:61, value:60},
    {source:64, target:60, value:20},
    {source:64, target:59, value:90},
    {source:64, target:57, value:10},
    {source:64, target:11, value:10},
    {source:65, target:63, value:50},
    {source:65, target:64, value:70},
    {source:65, target:48, value:30},
    {source:65, target:62, value:50},
    {source:65, target:58, value:50},
    {source:65, target:61, value:50},
    {source:65, target:60, value:20},
    {source:65, target:59, value:50},
    {source:65, target:57, value:10},
    {source:65, target:55, value:20},
    {source:66, target:64, value:30},
    {source:66, target:58, value:30},
    {source:66, target:59, value:10},
    {source:66, target:62, value:20},
    {source:66, target:65, value:20},
    {source:66, target:48, value:10},
    {source:66, target:63, value:10},
    {source:66, target:61, value:10},
    {source:66, target:60, value:10},
    {source:67, target:57, value:30},
    {source:68, target:25, value:50},
    {source:68, target:11, value:10},
    {source:68, target:24, value:10},
    {source:68, target:27, value:10},
    {source:68, target:48, value:10},
    {source:68, target:41, value:10},
    {source:69, target:25, value:60},
    {source:69, target:68, value:60},
    {source:69, target:11, value:10},
    {source:69, target:24, value:10},
    {source:69, target:27, value:20},
    {source:69, target:48, value:10},
    {source:69, target:41, value:10},
    {source:70, target:25, value:40},
    {source:70, target:69, value:40},
    {source:70, target:68, value:40},
    {source:70, target:11, value:10},
    {source:70, target:24, value:10},
    {source:70, target:27, value:10},
    {source:70, target:41, value:10},
    {source:70, target:58, value:10},
    {source:71, target:27, value:10},
    {source:71, target:69, value:20},
    {source:71, target:68, value:20},
    {source:71, target:70, value:20},
    {source:71, target:11, value:10},
    {source:71, target:48, value:10},
    {source:71, target:41, value:10},
    {source:71, target:25, value:10},
    {source:72, target:26, value:20},
    {source:72, target:27, value:10},
    {source:72, target:11, value:10},
    {source:73, target:48, value:20},
    {source:74, target:48, value:20},
    {source:74, target:73, value:30},
    {source:75, target:69, value:30},
    {source:75, target:68, value:30},
    {source:75, target:25, value:30},
    {source:75, target:48, value:10},
    {source:75, target:41, value:10},
    {source:75, target:70, value:10},
    {source:75, target:71, value:10},
    {source:76, target:64, value:10},
    {source:76, target:65, value:10},
    {source:76, target:66, value:10},
    {source:76, target:63, value:10},
    {source:76, target:62, value:10},
    {source:76, target:48, value:10},
    {source:76, target:58, value:10}
  ]
};
